package com.slz3.business.module.systemManagement.sysMenu.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.systemManagement.sysMenu.domain.SysMenu;
import com.slz3.business.module.systemManagement.sysMenu.domain.SysMenuFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class SysMenuTransactionalServiceImpl implements SysMenuTransactionalService {

    @Override
    public SysMenu modify(SysMenu sysMenuNew) {
        Repositorys.sysMenu.test();
        Repositorys.sysMenu.save(SysMenuFactory.initBaseFields());
        System.err.println(1/0);
        sysMenuNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.sysMenu.saveAndFlush(sysMenuNew);
    }

    @Override
    public List<SysMenu> batchModify(List<SysMenu> sysMenuList) {
        return Repositorys.sysMenu.saveAll(sysMenuList);
    }
}
